﻿using Microsoft.Extensions.Configuration;
using System;
namespace Odyssey.Application.Implementations
{
    public class ApplicationEnvironment : IApplicationEnvironment
    {
        private readonly IConfiguration configuration;

        public string EnvironmentName { get; }

        public string RootPath { get; }

        public ApplicationEnvironment(IConfiguration configuration)
        {
            EnvironmentName = configuration[HostDefaults.EnvironmentKey];
            if (string.IsNullOrWhiteSpace(EnvironmentName))
            {
                EnvironmentName = HostDefaults.EnvironmentProduction;
            }
            RootPath = AppContext.BaseDirectory;
        }
    }
}
